<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->uuid('id');
            $table->string('nickname')->index()->default('')->comment('用户昵称');
            $table->integer('phone')->unique()->default('0')->nullable()->comment('手机号');
            $table->string('password')->default('0')->nullable()->comment('密码');
            $table->string('openid')->default('0')->nullable()->comment('小程序openid');
            $table->string('sex')->default('0')->comment('性别 0为未知 1为男 2为女');
            $table->string('borthday')->default('0')->nullable()->comment('生日');
            $table->string('invite_code')->default('')->comment('邀请码');
            $table->integer('balance')->default('0')->nullable()->comment('余额');
            $table->string('superior_id')->index()->default('0')->nullable()->comment('上级id');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
